package com.cardone.platform.configuration.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.configuration.dao.DictionaryDao;
import com.cardone.platform.configuration.dto.DictionaryDto;

/**
 * 字典服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class DictionaryDefaultService implements DictionaryService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, DictionaryDto saveDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).saveByIdOrCode(mappedClass, saveDictionary);
	}
	
	@Override
	@Transactional
	public DictionaryDto saveByIdOrCode(DictionaryDto saveDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).saveByIdOrCode(DictionaryDto.class, saveDictionary);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, DictionaryDto findDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).findByCodeOrId(mappedClass, findDictionary);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(DictionaryDto readDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).readByCodeNqIdForCount(readDictionary);
	}
	
	@Override
	@Transactional
	public int insertByCode(DictionaryDto insertDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).insertByCode(insertDictionary);
	}
	
	@Override
	@Transactional
	public int updateByCode(DictionaryDto updateDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).updateByCode(updateDictionary);
	}

	@Override
	@Transactional
	public int deleteByIds(DictionaryDto deleteDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).deleteByIds(deleteDictionary);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, DictionaryDto findDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).findById(mappedClass, findDictionary);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, DictionaryDto findListDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).findListByLikeCode(mappedClass, findListDictionary);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(DictionaryDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, DictionaryDto paginationDictionary) {
		return ContextHolder.getBean(DictionaryDao.class).paginationByLikeCode(mappedClass, paginationDictionary);
	}
}